gdk: Remove gdk_cairo_get_clip_rectangle()
authorBenjamin Otte <otte@redhat.com>
Wed, 12 Feb 2020 22:45:51 +0000 (23:45 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 13 Feb 2020 06:36:38 +0000 (07:36 +0100)
The function is fundamentally broken for unbounded surfaces.
If a surface is unbounded, we cannot represent this as a
cairo_rectangle_int_t, and using the return value doesn't work because
it's already used for something else.

In GTK3, unbounded surfaces aren't a problem, but GTK4 uses recording
surfaces.

So better remove that function before we keep using it and using it
wrong.

docs/reference/gdk/gdk4-sections.txt
gdk/gdkcairo.c
gdk/gdkcairo.h

index bb56a12c26df1ec8a828e8742f5837050adce889..12cf24b4755cf57d177251c573de6f9f0fdf8613 100644 (file)
@@ -366,7 +366,6 @@ gdk_pango_layout_line_get_clip_region
 <TITLE>Cairo Interaction</TITLE>
 <FILE>cairo_interaction</FILE>
 gdk_surface_create_similar_surface
-gdk_cairo_get_clip_rectangle
 gdk_cairo_set_source_rgba
 gdk_cairo_set_source_pixbuf
 gdk_cairo_rectangle
index c5917cfeb9e76876fe0268979a411fae855713f1..e9fcdff08675aa0dbc50712f5696566573a1a33b 100644 (file)
  */
 
 
-/**
- * gdk_cairo_get_clip_rectangle:
- * @cr: a cairo context
- * @rect: (out) (allow-none): return location for the clip, or %NULL
- *
- * This is a convenience function around cairo_clip_extents().
- * It rounds the clip extents to integer coordinates and returns
- * a boolean indicating if a clip area exists.
- *
- * Returns: %TRUE if a clip rectangle exists, %FALSE if all of @cr is
- *     clipped and all drawing can be skipped
- */
-gboolean
-gdk_cairo_get_clip_rectangle (cairo_t      *cr,
-                              GdkRectangle *rect)
-{
-  double x1, y1, x2, y2;
-  gboolean clip_exists;
-
-  cairo_clip_extents (cr, &x1, &y1, &x2, &y2);
-
-  clip_exists = x1 < x2 && y1 < y2;
-
-  if (rect)
-    {
-      x1 = floor (x1);
-      y1 = floor (y1);
-      x2 = ceil (x2);
-      y2 = ceil (y2);
-
-      rect->x      = CLAMP (x1,      G_MININT, G_MAXINT);
-      rect->y      = CLAMP (y1,      G_MININT, G_MAXINT);
-      rect->width  = CLAMP (x2 - x1, G_MININT, G_MAXINT);
-      rect->height = CLAMP (y2 - y1, G_MININT, G_MAXINT);
-    }
-
-  return clip_exists;
-}
-
 /**
  * gdk_cairo_set_source_rgba:
  * @cr: a cairo context
index c4e2d3836c4bcf823a7f02b543af1e3261450af8..49b4117eb094c4833d674577871ac67e83d7cd08 100644 (file)
 
 G_BEGIN_DECLS
 
-GDK_AVAILABLE_IN_ALL
-gboolean   gdk_cairo_get_clip_rectangle (cairo_t            *cr,
-                                         GdkRectangle       *rect);
-
 GDK_AVAILABLE_IN_ALL
 void       gdk_cairo_set_source_rgba    (cairo_t              *cr,
                                          const GdkRGBA        *rgba);